﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lidgren.Network;

namespace Network.Messages.LiveControl
{
    public class RequestScreenshotMessage : NovaMessage
    {
        public RequestScreenshotMessage()
            : base((ushort) CustomMessageType.RequestScreenshotMessage)
        {
        }
        /// <summary>
        /// 第一帧
        /// </summary>
        public bool FlagFirstFrame =false;
        /// <summary>
        /// 要显示的进程ID
        /// </summary>
        public int Id = -1;

        public int ScreenIndex = 0;

        private bool _resolve = false;

        /// <summary>
        /// 如果是关键帧，则必面要被处理了才能被后面的请求覆盖
        /// </summary>
        public bool Resolve {
            get
            {
                //如果不是关键帧，或者已被解决，返回true;
                return  (!FlagFirstFrame)|| _resolve ;
            }
            set { _resolve = value; }}
        public override void WritePayload(NetOutgoingMessage message)
        {
            base.WritePayload(message);
            message.Write(FlagFirstFrame); 
            message.Write(Id);
            message.Write(ScreenIndex);
        }

        public override void ReadPayload(NetIncomingMessage message)
        {
            base.ReadPayload(message);
            FlagFirstFrame = message.ReadBoolean();
            Id = message.ReadInt32();
            ScreenIndex = message.ReadInt32();
        }
    }
}
